﻿<%@ Page Title="" Language="C#" MasterPageFile="~/cadastros/Site.Master" AutoEventWireup="true" CodeBehind="Setor.aspx.cs" Inherits="CongregacaoOs.WebForm.Cadastros.Setor" %>

<%@ Register Src="~/Cadastros/MessageWindow.ascx" TagPrefix="uc1" TagName="MessageWindow" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="css/GridView.css" rel="stylesheet" />

    <script src="../Scripts/Mascaras.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            var activeIndex = parseInt($('#<%=hfIndexAccordion.ClientID %>').val());

            var aicons = {
                header: "ui-icon-circle-arrow-e",
                activeHeader: "ui-icon-circle-arrow-s"
            };

            $("#accordion").accordion({
                collapsible: true,
                autoHeight: false,
                navigation: true,
                active: activeIndex,
                icons: aicons,
                change: function (event, ui) {
                    var index = $(this).children('h3').index(ui.newHeader);
                    $('#<%=hfIndexAccordion.ClientID %>').val(index);
                }
            });
        });

        $(function () {
            $("#resizable").resizable({
                animate: true
            });
        });

    </script>

    <style type="text/css">
        .auto-style1 {
            width: 471px;
        }



        #resizable {
            width: 457px;
            height: 188px;
            padding: 0.5em;
        }

            #resizable h3 {
                text-align: center;
                margin: 0;
            }

        .ui-resizable-helper {
            border: 1px dotted gray;
        }

        .auto-style3 {
            width: 40px;
        }
    </style>

    <link href="../Content/NewTheme/gridView.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:HiddenField ID="hfIndexAccordion" runat="server" />


    <div id="accordion">
        <h3><a href="#">Consultar</a></h3>
        <div>

            <asp:Panel ID="PainelConsulta" runat="server" Style="width: 70%; margin: 0 auto;">

                <h2>Cadastro de Setor</h2>
                <hr />
                <br />
                <table width="100%">
                    <tr>
                        <td>Nome:<br />
                            <asp:TextBox ID="txtBuscarNome" Width="100%" runat="server"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>
                            <br />
                            <hr />
                            <asp:GridView ID="gvSetor" runat="server" Style="font-size: smaller;"
                                AutoGenerateColumns="False"
                                GridLines="None"
                                AllowPaging="True"
                                CssClass="mGrid"
                                PagerStyle-CssClass="pgr"
                                AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="gvSetor_PageIndexChanging" OnRowCommand="gvSetor_RowCommand" OnRowDataBound="gvSetor_RowDataBound" PageSize="7">
                                <AlternatingRowStyle CssClass="alt" />
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Edit.png" CommandName="EDITAR" CommandArgument="<%# Bind('idSetor') %>" ToolTip="Editar" runat="server" Width="20px" ID="imgEditar" />
                                            &nbsp;&nbsp;&nbsp;
                                <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Delete.png" CommandName="EXCLUIR" runat="server" CommandArgument="<%# Bind('idSetor') %>" ToolTip="Excluir" Width="20px" ID="imgDelete" />


                                            <asp:HiddenField ID="hdIdSetor" runat="server" Value="<%# Bind('IdSetor') %>" />
                                        </ItemTemplate>
                                        <ItemStyle Width="15%" HorizontalAlign="Center" VerticalAlign="Middle" />
                                        <HeaderStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="idSetor" HeaderText="Código">
                                        <ItemStyle Width="5%" HorizontalAlign="Center" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="nome" HtmlEncode="false" HeaderText="Setor">
                                        <ItemStyle Width="70%" HorizontalAlign="Left" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                    </asp:BoundField>
                                </Columns>
                                <EmptyDataTemplate>
                                    Nenhum registro encontrado...
                                </EmptyDataTemplate>
                                <PagerStyle CssClass="pgr" />
                            </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="float: right;">
                                <asp:Button ID="btnBuscar" runat="server" Text="Pesquisar" OnClick="btnBuscar_Click" />
                                <asp:Button ID="btnAdicionarNovo" runat="server" Text="Adicionar " OnClick="btnAdicionarNovo_Click" />
                            </div>
                        </td>
                    </tr>
                </table>



            </asp:Panel>
        </div>

        <h3><a href="#">Cadastrar/Editar</a></h3>
        <div>
            <asp:Panel ID="painelCadastro" runat="server" Style="width: 70%; margin: 0 auto;">
                <asp:HiddenField ID="hdID" runat="server" />

                <label>Nome:</label>
                <br />
                <asp:TextBox ID="txtNome" Width="100%" runat="server"></asp:TextBox><br />
                <br />
                <div id="resizable" class="ui-widget-content">
                    <h3 class="ui-widget-header">Cargos do Setor</h3>
                    <table>
                        <tr>
                            <td>
                                <asp:ListBox ID="listCargos" DataTextField="nome" DataValueField="idCargo"
                                    runat="server" Height="152px" Width="174px"></asp:ListBox>
                            </td>
                            <td>
                                <asp:Button ID="btnAdd" runat="server" Text=">" OnClick="btnAdd_Click" Width="93px" />
                                <br />
                                <asp:Button ID="btnRemove" runat="server" Text="<" OnClick="btnRemove_Click" Width="93px" />
                                <br />
                                <asp:Button ID="btnAddAll" runat="server" Text=">>" OnClick="btnAddAll_Click" Width="93px" />
                                <br />
                                <asp:Button ID="btnRemoveAll" runat="server" Text="<<" OnClick="btnRemoveAll_Click" Width="93px" />
                                <br />
                            </td>
                            <td>
                                <asp:ListBox ID="ListCargosResult" runat="server" Height="152px" Width="174px"></asp:ListBox>
                            </td>
                        </tr>
                    </table>

                </div>


                <br />
                <asp:Button ID="btnSalvar" runat="server" Text="Salvar" OnClick="btnSalvar_Click" />
                <asp:Button ID="btnVoltar" runat="server" Text="Voltar" OnClick="btnVoltar_Click" />
            </asp:Panel>
        </div>

    </div>

    <uc1:MessageWindow runat="server" ID="MessageWindow" />

</asp:Content>
